Skip to content

Add helper extractor tests - #1274

Merged
frenck merged 1 commit into
mainfrom
test/port-helper-extractor-tests
May 27, 2026
Merged

frenck merged 1 commit into
mainfrom
test/port-helper-extractor-tests

Conversation

@frenckatron

@frenckatron frenckatron commented May 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add focused tests for existing helper behavior salvaged from #1254:

  • utility helpers for template detection, comma-separated entity IDs, and template string extraction
  • script unknown entity trigger extraction, including nested and blueprint-style trigger input shapes

No stale scaffold, workflow, dependency, or lockfile changes from #1254 are included.

Motivation and Context

These tests pin down behavior that is useful before refactoring the unknown-reference repairs and utility helpers. They give the follow-up cleanup work a safer baseline.

How has this been tested?

  • uv run pytest tests/test_util.py tests/ectoplasms/script/repairs/test_unknown_entity_references.py -q
  • uv run pytest -q
  • uv run ruff check tests/test_util.py tests/ectoplasms/script/repairs/test_unknown_entity_references.py tests/ectoplasms/__init__.py tests/ectoplasms/script/__init__.py tests/ectoplasms/script/repairs/__init__.py
  • uv run ruff format --check tests/test_util.py tests/ectoplasms/script/repairs/test_unknown_entity_references.py tests/ectoplasms/__init__.py tests/ectoplasms/script/__init__.py tests/ectoplasms/script/repairs/__init__.py
  • uv run pylint tests/test_util.py tests/ectoplasms/script/repairs/test_unknown_entity_references.py

Screenshots (if appropriate):

Not applicable.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@coderabbitai

coderabbitai Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds comprehensive test coverage for utility helpers and unknown entity reference extraction. The changes include new test modules for extract_entities_from_trigger_config and three utility functions (is_template_string, split_comma_separated_entity_ids, extract_template_strings_from_config), plus test package docstrings.

Changes

Test Coverage for Utility and Extraction Helpers

Layer / File(s) Summary
Test package initialization and structure
tests/ectoplasms/__init__.py, tests/ectoplasms/script/__init__.py, tests/ectoplasms/script/repairs/__init__.py
Adds module-level docstrings documenting the test package hierarchy for ectoplasms, script, and repairs.
Unknown entity reference extraction tests
tests/ectoplasms/script/repairs/test_unknown_entity_references.py
Tests extract_entities_from_trigger_config across string and list entity IDs, nested dictionaries, top-level lists, blueprint-shaped inputs with discard_when, and edge cases (None, empty, scalars, missing fields).
Utility helper function tests
tests/test_util.py
Tests for is_template_string (Jinja pattern detection), split_comma_separated_entity_ids (comma splitting and trimming), and extract_template_strings_from_config (recursive template extraction from nested structures with accumulator support).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop along the test path bright,
With coverage bounds drawn tight,
Templates, entities, all in sight,
The helpers dance through day and night,
A safer spook awaits the light! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add helper extractor tests' is concise and accurately describes the primary change: adding test suites for helper functions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly relates to the changeset, describing the addition of focused tests for helper behavior and mentioning specific test files and utility functions being tested.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/port-helper-extractor-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@frenckatron frenckatron added the maintenance Generic maintenance tasks. label May 27, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.84%. Comparing base (10e1226) to head (1936b33).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1274      +/-   ##
==========================================
+ Coverage   34.89%   36.84%   +1.94%     
==========================================
  Files         117      117              
  Lines        3029     3029              
  Branches      411      411              
==========================================
+ Hits         1057     1116      +59     
+ Misses       1959     1898      -61     
- Partials       13       15       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds focused pytest coverage for utility helper extraction behavior and script unknown entity trigger extraction, fitting into the existing Spook repair/helper testing structure.

Changes:

  • Adds utility tests for template detection, comma-separated entity ID splitting, and recursive template string extraction.
  • Adds script repair helper tests for trigger entity extraction across scalar, list, nested, empty, and blueprint-style inputs.
  • Adds package marker docstrings for the new tests/ectoplasms/script/repairs test hierarchy.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_util.py Adds helper coverage for utility extraction functions.
tests/ectoplasms/script/repairs/test_unknown_entity_references.py Adds script trigger entity extraction tests.
tests/ectoplasms/__init__.py Adds test package marker.
tests/ectoplasms/script/__init__.py Adds script test package marker.
tests/ectoplasms/script/repairs/__init__.py Adds script repair test package marker.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@frenck
frenck merged commit 4adf17f into main May 27, 2026
20 of 21 checks passed
@frenck
frenck deleted the test/port-helper-extractor-tests branch May 27, 2026 21:07
@coderabbitai coderabbitai Bot mentioned this pull request May 27, 2026
2 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Generic maintenance tasks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants